<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let cay = [10, 3, 2, 3, 32, 32, 32, 32, 32, 3, 23, 232, 1, 2];
        let op = new Map();
        cay.forEach(value => {
            op.set(value, 1);
        });
        console.log(op, "op");
        let newCay = [...new Set(cay)];
        console.log(newCay);
        let cat = {
            name: "白猫",
            with: "黑猫"
        }
        console.log(cat, "cat");
        let wo = {
            call: "woz"
        }
        let catA = new Map();
        catA.set("id", "ca")
        console.log(catA);
        console.log(catA.get("id"));
        catA.set(cat, "猫窝");
        console.log(catA.get(cat));
        catA.set({
            "id": "casss",
            "ap": "caeeee"
        });
        console.log(catA);
        function mySet(options, cat) {
            for (let key in options) {
                cat.set(key, options[key]);
            }
            return cat;
        }
        let call = mySet(cat, new Map());
        console.log(call);
        call.set(wo, {
            call: "this"
        });
        console.log(call);

        let myArray = [1, 2, 3, 4, 5, 2, 1];
        function getArray(array) {
            let newArray = [];
            let map = new Map();
            for (let i = 0, l = array.length; i < l; i++) {
                if (typeof map.get(array[i]) == "undefined") {
                    map.set(array[i], array[i]);
                    newArray.push(array[i]);
                }
            }
            return newArray;
        }
        console.log(getArray(myArray));

        let poo = {
            id: 'caas',
            cals: "cscs",
            ms: "ee"
        }
        console.log("id" in poo);
        Reflect.deleteProperty(poo, "id");
        console.log(Reflect.has(poo, "id"));
        let boo = new Proxy(cat, {
            get(target, key) {
                console.log(target[key]);
            },
            set(target, key, value) {
                target[key] = value;
                console.log("this", target);
            }
        });
        boo.po = "map";
        let o = {
            name:'co',
            keys(){
                console.log(this,"keys");
                (()=>{
                    console.log(this,"箭头函数");
                })();
            }
        }
        o.keys();
        //箭头函数中使用this，从当前层向上层父级中查找，到最先找到的以function定义的函数作用域的this指向为准
    </script>
</body>

</html>